Developer Documentation

QuickTime 4 API Documentation

QuickTime 4 Reference

| Previous | Chapter Contents | Chapter Top | Next |

Functions

DataCodecCompress

The DataCodecCompress function compresses data using the specified compressor component.

pascal ComponentResult DataCodecCompress (
                     DataCodecComponent dc,
                     void *srcData,
                     UInt32 srcSize,
                     void *dstData,
                     UInt32 dstBufferSize,
                     UInt32 *actualDstSize,
                     UInt32 *decompressSlop );
dc
Specifies the compressor component to used.

srcData
Contains a pointer to the data to be compressed.

srcSize
Contains the size of the data to be compressed, in bytes.

dstData
Contains a pointer to the buffer in which to store the compressed data.

dstBufferSize
Contains the size of the buffer in which to store the compressed data, in bytes.

actualDstSize
Contains the size of the compressed data that was created, in bytes.

decompressSlop
Contains the number of bytes that should be added to the decompression buffer size if decompression occurs in place.

DISCUSSION

Before calling the DataCodecCompress function, you should call the DataCodecGetCompressBufferSize function to obtain the maximum possible size of the compressed data that will be returned. You can then use this value as the value of the dstBufferSize parameter. Note that a buffer for compressed data that is the same size as the uncompressed data may not be large enough: in some cases, the size of the compressed data can be larger than the size of the decompressed data.

When you compress data, you should store the size of data before compression at the beginning of the file, immediately before the compressed data. This allows you to obtain the size of the decompressed data and allocate the buffer for storing the decompressed data before calling the DataCodecDecompress function.

You can compress sprites by calling the DataCodecCompress function. If you do, you must

You can compress 3D media samples by calling the DataCodecCompress function. If you do, you must

DataCodecDecompress

The DataCodecDecompress function decompresses data using the specified compressor component.

pascal ComponentResult DataCodecDecompress (
                     DataCodecComponent dc,
                     void *srcData,
                     UInt32 srcSize,
                     void *dstData,
                     UInt32 dstBufferSize );
dc
Specifies the decompressor component to used.

srcData
Contains a pointer to the data to be decompressed.

srcSize
Contains the size of the data to be decompressed, in bytes.

dstData
Contains a pointer to the buffer in which to store the decompressed data.

dstBufferSize
Contains the size of the buffer in which to store the decompressed data, in bytes.

DISCUSSION

Before allocating the buffer in which to store decompressed data, you need to get the size of the decompressed data. The size is normally stored at the beginning of the file, immediately before the compressed data.

Performing Compression and Decompression at Interrupt Time


© 1999 Apple Computer, Inc.

| Previous | Chapter Contents | Chapter Top | Next |